//
//  SGSpringGraph.h
//  SpringGraph Test
//
//  Created by Jack Herrington on 5/30/10.
//  Copyright 2010 Myself. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "FLForceDirectedLayout.h"
#import "SGGraphDataProvider.h"

@protocol SGSpringGraphDelegate
@optional
- (void)itemTouched:(id)sender view:(UIView *)view;
@end

@interface SGSpringGraph : UIView <SGGraphDataDelegate> {
	id<NSObject, SGSpringGraphDelegate> delegate;
	
	NSTimer *repeatingTimer;
	
	UIColor *lineColor;
	UIColor *distinguishedLineColor;
	
	SGGraphDataProvider *data;
	
	UIView *draggingNode;
	
	float _repulsionFactor;
	float defaultRepulsionFactor;
	
	FLForceDirectedLayout *forceDirectedLayout;
	
	UIView *_distinguishedView;

	UIView *edgeHost;
	NSMutableDictionary *edgeViewMap;
	
	NSInteger nextTagIndex;
}

@property (retain) id<NSObject, SGSpringGraphDelegate> delegate;

@property (retain) UIColor *lineColor;
@property (retain) UIColor *distinguishedLineColor;
@property (retain) UIView *distinguishedView;

- (SGEdgeData *)connect:(UIView *)from to:(UIView *)to;
- (void)disconnect:(UIView *)from to:(UIView *)to;

@end
